import React, {Component} from 'react'
import {inject, observer} from 'mobx-react';
import {WeaDialog, WeaLocaleProvider,WeaFormItem,WeaSelect,WeaBrowser} from 'ecCom'
import {Button} from "antd";
const getLabel = WeaLocaleProvider.getLabel;


@inject('blogMyBlog')
@observer
class ViewMyBlog extends Component {
    constructor(props) {
        super(props)
        this.state={
            selectTypeKey:"1",
            brwDatas:[],
            userids:""
        }
    }

    componentDidMount() {


    }



    okSave = () => {
        const {userids} = this.state;
        const {saveBlogDiscussShare,shareDiscussId,shareType} = this.props.blogMyBlog;
        let param={shareType:shareType,content:userids,discussid:shareDiscussId};
        saveBlogDiscussShare(param);
    }


    render(){

        const {changeShowViewMy,changeShareContent,showViewMyBlogVisible,shareType,replaceDatas,changeReplaceDatas,changeShareType} = this.props.blogMyBlog;
        return  <WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@zhtrt6`}
            title={getLabel(500885,'可见范围') }
            icon="icon-coms-blog"
            iconBgcolor="#6d3cf7"
            buttons={[
                <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@58mdbzcomfirm`} type="primary"
                onClick={this.okSave}

                >{getLabel(33703,'确认') }</Button>,
                <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@q6775s@cancel`}
                   type="ghost" onClick={()=>{changeShowViewMy(false)}}
                >{getLabel(31129, "取消")}</Button>
            ]}
            style={{width: 400, height: 250}}
            visible={showViewMyBlogVisible}
            onCancel={() => {changeShowViewMy(false)}}
        >
            <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@j2arzw`}
                label={getLabel(521692,'谁可以看') }
                labelCol={{span: 6}}
                wrapperCol={{span: 18}}
                style={{"padding":"45px"}}
            >
                <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@n2vkc2`}
                    options={[{
                        key: "1",
                        selected: true,
                        showname: getLabel(2161,'公开')
                    },{
                        key: "2",
                        selected: false,
                        showname: getLabel(83281,'私密')
                    },{
                        key: "3",
                        selected: false,
                        showname: getLabel(521693,'包含人员')
                    },
                        {
                            key: "4",
                            selected: false,
                            showname: getLabel(521694,'排除人员')
                        }]}
                    value ={shareType}
                    onChange={(v, showname) => {
                        changeShareType(v);
                    }}
                    helpfulTip={getLabel(521695,'人员选项是关注人员,默认分享的人员不在范围内')}
                />
            </WeaFormItem>
                {shareType=="3"||shareType=="4"?
                    <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@59dclp`}
                        label={getLabel(33210,'选择人员') }
                        labelCol={{span: 6}}
                        wrapperCol={{span: 18}}
                        style={{"padding": "0px 45px 0px 45px",
                            "margin-top": "-26px"
                        }}
                    ><WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@fje891`}
                    type="blogAttentionUsers"
                    textDecoration={true}
					viewAttr={3}
                    inputStyle={{ width: 232 }}
                    onChange={(ids, names, datas) =>
                    {
                        changeReplaceDatas(datas);
                        changeShareContent(ids);
                    }
                    }
                    replaceDatas={replaceDatas}

                    isSingle={false}
                    /></WeaFormItem>:"" }
        </WeaDialog>
    }

}

export default ViewMyBlog


// WEBPACK FOOTER //
// ./../src4js/pc4mobx/blog/components/MyBlog/LeftContainer/ViewMyBlog.js